<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    
  </style>
</head>
<body>
  
</body>
<script>

  var msg = 365;
  console.log( msg );
  console.log( typeof msg );
  var res = String( msg );
  console.log( res );
  console.log( typeof res );

  // 直接套引号
  console.log( String( 365 ) );
  console.log( String( true ) );
  console.log( String( false ) );
  console.log( String( function(){} ) );
  console.log( String( undefined ) );
  console.log( String( null ) );
  console.log( String( NaN ) );
  // 直接套引号

  // 转成："[object Object]"
  console.log( String( {} ) );
  console.log( String( {name:"admin"} ) );
  // 转成："[object Object]"

  // 将中括号替换成引号
  console.log( String( [] ) );
  console.log( String( [ ] ) );
  console.log( String( [365,567] ) );
  console.log( String( [365, 567] ) );
  console.log( String( [{}] ) );
  console.log( String( [{}, {}] ) );
  console.log( String( [345, undefined, null, 678] ) );
  // 将中括号替换成引号
  
  console.log("-----")


  // null
  console.log( null )
  // undefined
  console.log( undefined )
  // 空对象
  console.log( {} )
  // 空数组
  console.log( [] )
  // 空函数
  console.log( function(){} )
  // 空字符
  console.log( "" )
  console.log( " " )


  console.log("------")


  console.log( {}.toString() );
  console.log( {name:"admin"}.toString() );
  console.log( [].toString() );
  console.log( [365].toString() );
  console.log( [365,678].toString() );
  console.log( [{},{}].toString() );
  console.log( function(){}.toString() );
  console.log( true.toString() );
  
  
  // console.log( 365.toString() );
  // console.log( undefined.toString() );
  // console.log( null.toString() );
  // console.log( (undefined).toString() );
  
  console.log( (365).toString() );
  var n = 365;
  console.log( n.toString() );


  console.log("-------")


  console.log( (365.789).toFixed(1) );
  var m = 3.1415926;
  console.log( m.toFixed(3) );
  console.log( m.toFixed(10) );





  
</script>
</html>